package com.exposit.zbs.dao.impl;

import com.exposit.zbs.dao.IMessagesDAO;
import com.exposit.zbs.dao.base.BaseDAO;
import com.exposit.zbs.entity.MessageEntity;
import org.springframework.stereotype.Repository;


/**
 * Created by Andrey on 04.09.2014.
 */
@Repository
public class MessagesDAO  extends BaseDAO<MessageEntity, Long> implements IMessagesDAO {

	@Override
	public void readMessages(Long userId) {
		getSession().createQuery("update MessageEntity m set m.isReaded = 1 where m.userEntityByReciverId.userId = :userId").setString("userId", userId.toString()).executeUpdate();
	}
}
